package com.briup.app04.web.controller;

import com.briup.app04.bean.Article;
import com.briup.app04.service.IArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/article")
public class ArticleController {
    @Autowired
    private IArticleService articleService;

    @PostMapping("findAll")
    public List<Article> findAll() {

        return articleService.findAll();
    }

    @PostMapping("saveOrUpdate")
    public String saveOrUpdate(Article article) {
        articleService.saveOrUpdate(article);
        return "保存成功";
    }
    @PostMapping("deleteById")
    public String deleteById(Long id) {
        articleService.deleteById(id);
        return "删除成功";
    }
}



